package com.example.javaserve.config;

import cn.hutool.extra.mail.MailAccount;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @projectName: my_project
 * @package: com.example.javaserve.config
 * @className: EmailConfig
 * @author: xxXPCSC
 * @description: TODO
 * @date: 2023/11/15 15:40
 * @version: 1.0
 **/
@Data
@Component
@ConfigurationProperties(prefix = "spring.mail")
public class EmailConfig {

    public final static String PRE = "email";

    private String host;
    private Integer port;
    private String from ;
    private String pass;

    public MailAccount getAccount() {
        MailAccount account = new MailAccount();
        account.setAuth(true);
        account.setHost(host);
        account.setPort(port);
        account.setFrom(from);
        account.setUser(from);
        account.setPass(pass);
        return account;
    }
}

